import React, { useState } from 'react'
import BraftEditor from 'braft-editor'
import 'braft-editor/dist/index.css'


function Editor() {

    const [editorState, setEditorState] = useState('')
    const submitContent = async () => {

        // const htmlContent = editorState.toHTML()
        console.log(editorState.toHTML());
    }

    const handleEditorChange = (e) => {
        // console.log(editorState);
        setEditorState(e)
    }
    return (
        <div className="my-component">
            <button onClick={() => { submitContent() }}>获取输入的内容</button>
            <BraftEditor
                value={editorState}
                onChange={(e) => { handleEditorChange(e) }}
            />
        </div>
    )
}

export default Editor